#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>


typedef uint8_t t_Sector[512];
typedef uint8_t t_Cluster[4096];

typedef struct {
	/* FAT 32 Boot Sector according to http://en.wikipedia.org/wiki/File_Allocation_Table*/
	uint8_t jumpInst[3];
	uint8_t oemName[8];
	uint16_t bytesPerSec;
	uint16_t secPerClus;
	uint16_t reservedSecCnt;
	uint8_t numberOfFAT;
	uint16_t rootEntCnt;
	uint16_t totalSectors16 ;
	uint8_t media;
	uint16_t FATSz16;
	uint16_t sectorsPerTrack ;
	uint16_t numberOfHeads;
	uint32_t hiddenSectors;
	uint32_t totalSectors32;
	/* Fat 12;16;32  37*/

	uint32_t sectorsPerFAT;
	uint16_t FATFlags;
	uint16_t version;
	uint32_t rootCluster;
	uint32_t FSInfo;
	uint16_t backupBootSector;
	uint8_t reserved[12];
	uint8_t physicalDriveNumber;
	uint8_t reserved1;
	uint8_t bootSignature;
	uint32_t volumeID;
	uint8_t volumeLabel[11];
	uint8_t fileSystemType[8];
	/*Fat 32 Only 56*/

} __attribute__ ((packed)) t_FAT32BootSector;


typedef struct {
	uint32_t signature;
	uint8_t reserved[480];
	uint32_t signature1;
	int32_t freeClustersNumber;
	uint32_t mostRecentlyAllocatedClusters;
	uint8_t reserved1[12];
	uint32_t sinature2;
}t_FSInformationSector;


